﻿using UnityEngine;
using System.Collections;

public class Blue : MonoBehaviour {
    public float speed;
	// Use this for initialization
	void Start () {
	}
	
    // Update is called once per frame
    void Update () {
        this.transform.Translate (Vector2.up * speed * Time.deltaTime);
        
    }
    
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "wall") {
            speed = -speed;
        }
        else
        {
//            Destroy(other.gameObject);
            MapManager.gameState = MapManager.STATE_END;
        }
        
    }
}
